package net.sx.minemodule.mvp.presenters;

import android.util.Log;

import com.alibaba.android.arouter.launcher.ARouter;
import com.homegoods.aroutercomment.ARouterPath;
import com.homegoods.classify.model.Constant;
import com.homegoods.resource.HomeGoodsApp;
import com.kedll.library.mvp.AbstractRefreshPresenter;
import com.kedll.library.mvp.RefreshingView;

import net.sx.minemodule.mvp.bean.RecommendShopBean;

import java.util.Random;

import io.reactivex.Observable;

/**
 *  我的 模块
 * @author 11470
 */
public class MineListPresenter extends AbstractRefreshPresenter<RefreshingView> {
    private Random random;

    public MineListPresenter(RefreshingView mView) {
        super(mView);
        random = new Random();
    }

    @Override
    protected void initItems() {
    }

    @Override
    protected void fetchData(boolean isLoadMore) {
        //在这里创建数据
        addSubscription(Observable.range(0, 9)
                .map(integer -> {
                    RecommendShopBean bean = new RecommendShopBean();   //推荐商品实体类
                    bean.setRecommendShopPeople(integer + "百人已付款");
                    bean.setRecommendShopName("卡斗");
                    bean.setRecommendShopMoney("¥" + integer);
                    bean.setRecommendShopMerchant("剃须刀");
                    bean.setRecommendPath(Constant.TEST_IMG_URL + random.nextInt());
                    return bean;
                })
                .toList()
                .subscribe(recommendShopBeans -> parserData(isLoadMore, recommendShopBeans)));
    }

}
